package com.oe.web;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class LoginController {

    String superManageUser="admin";

    String superManagerPassword="admin";

    @RequestMapping("/index")
    public String login(){
        return "loginIndex";
    }

    @RequestMapping("/login")
    public String loginSubmit(HttpServletRequest request,String username, String password){
        if (superManageUser.equals(username)&&superManagerPassword.equals(password)){
            request.getSession().setAttribute("loginToken",username+":"+password);
        }else {
            return "loginIndex";
        }
        return "redirect:/resume/index";
    }
}
